<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>合生元</title>
     <script src="../assets/scripts/draw/jquery-1.11.2.min.js"></script>
    <script>
        var phoneWidth = parseInt(window.screen.width);
        var phoneHeight = parseInt(window.screen.height);
        var phoneScale = phoneWidth / 640;
        var ua = navigator.userAgent;
        if (/Android (\d+\.\d+)/.test(ua)) {
            var version = parseFloat(RegExp.$1);
            if (version > 2.3) {
                document.write('<meta name="viewport" content="width=640, initial-scale= ' + phoneScale + ' ,minimum-scale = ' + phoneScale + ', maximum-scale = ' + phoneScale + ', target-densitydpi=device-dpi">');
            }
            else {
                document.write('<meta name="viewport" content="width=640, initial-scale= ' + phoneScale + ' , target-densitydpi=device-dpi">');
            }
        }
        else {
            document.write('<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">');
        }</script>
    <link rel="stylesheet" href="../assets/css/draw/main2.css"/>
</head>
<body>
<div class="wrap winningList">
    <div class="winningList-frame" id="scrollDiv">
        <ul id= "ulwinner">
  					<c:forEach items="${winnerList}" var="winner">
  						<li>
		                <div class="user-box">
		                    <span class="username">${winner.receiver }</span>
		                    <span class="phone">${winner.subMobile }</span>
		                </div>
		                <h2 class="winniang-name">${winner.awardname}</h2>
<!-- 		                <a href="javascript:;" class="winning-img">
		                </a> -->
		                <img src="${winner.image }" alt="合生元" width="79" height="85">
		                </li>
	                </c:forEach>             
        </ul>
        <a href="javascript:history.go(-1)" class="return-btn">返回</a>
    </div>
    <div class="winningList-bird"></div>
</div>

<!--js-->
<script src="http://wximg.qq.com/wxp/libs/wxmoment/0.0.4/wxmoment.min.js"></script>
   <script type="text/javascript">
	function onBridgeReady(){
		WeixinJSBridge.call('hideOptionMenu');
	}
	
	if (typeof WeixinJSBridge == "undefined"){
	if( document.addEventListener ){
			document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
		}else if (document.attachEvent){
			document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
			document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
		}
	}else{
		onBridgeReady();
	}
</script>    
<script>
$(document).ready(function(){      
		
    //从第几页开始加载
      var num = ${pageindex} + 1;              
      var totalheight = 0;   
      var winner = $("#ulwinner");
      var endFlag = true;
            
      $("#ulwinner").scroll(function(){  
    	      	  
          var $this =$(this),
          viewH =$(this).height(),//可见高度
          contentH =$(this).get(0).scrollHeight,//内容高度
          scrollTop =$(this).scrollTop();//滚动高度            

          if(scrollTop/(contentH -viewH)>=0.99) {  
  		    $.post("getWinner",
  				    {
  		    			openid : "${openId}",
  		    			pageindex  : num,
  		    			pagesize : "${pagesize}"
  				    },
  				    function(data,status){
	    				      var strHtml = "";
	    				      var awardImage = "";
	    					  var array = data;		
	    				      array.forEach(function(ele,index){ 		 
	    				    	  strHtml +="<li>"
	    				    		  +"<div class='user-box'>"
	    				    		  +"<span class='username'>"+ele.receiver+"</span>"
	    				    		  +"<span class='phone'>"+ele.subMobile+"</span>"
	    				    		  +"</div>"
	    				    		  +"<h2 class='winniang-name'>"+ele.awardname+"</h2>"
	    				    		  +"<img src="+ele.image+" alt='合生元' width='79' height='85'>"
	    		                +"</li>"
	    				    	  
	    				      });
	    				      winner.append(strHtml);
/* 	    				      if(array.length == 0 && endFlag == true){
									alert("暂无更多数据了！");
									endFlag = false;
	    				      }  */
  					});		
              num++;  
          }  
	             
      });  
  });  
</script>
</body>
</html>